|
|
|
|
|
|
|
A method is a procedure or function thats a part of an object you use. Its used to perform an action on a particular object. For example, a form is an object that has a Show method used to display the form. Theres also a Refresh method on the form object (as well as on most controls, such as text boxes). Controls are also objects and, as such, have methods. Here are the major differences between methods and procedures: |
|
|
|
|
|
|
|
|
You cannot view or modify the code for a method on a Visual Basic object. |
|
|
|
|
|
|
|
|
Methods are always bound to an object. You must specify the object name first and then the name of the method. |
|
|
|
|
|
|
|
|
Youll need to learn a few methods for the different objects. Most are self-explanatory. Table 10.2 shows you a list of the different objects and the various methods you can invoke on those objects. |
|
|
|
|
| Table 10.2 Common Methods. | | Method | Applies To | Description | | Me.Cls | Forms | Clears the graphic or text drawn on a form. | | Hide | Forms | Used to hide a form without unloading it. | | Line | Forms | Used to draw a line on the form area. | | Move | Forms, most controls | Used to move an object from one location to another and, optionally, change the size of the object. | | PaintPicture | Forms, graphical controls | Used to draw a bitmap or other picture on a form, picture box, image box, or other graphical control. | | PopupMenu | Forms | Displays a pop-up menu over a form. | | PrintForm | Forms | Prints the currently displayed image of the form to the default printer. |
|
|
|
|
|
|
(table continued on next page) |
|
|
|
|
|